Method and apparatus for encoding and decoding motion vector by obtaining motion vector predictor candidate using co-located block

ABSTRACT

Provided are methods and apparatuses for encoding and decoding a motion vector. The method of encoding a motion vector includes: selecting a mode from among a first mode in which information indicating a motion vector predictor of at least one motion vector predictor is encoded and a second mode in which information indicating generation of a motion vector predictor based on pixels included in a previously encoded area adjacent to a current block is encoded; determining a motion vector predictor of the current block according to the selected mode and encoding information about the motion vector predictor of the current block; and encoding a difference vector between a motion vector of the current block and the motion vector predictor of the current block.

CROSS-REFERENCE TO RELATED PATENT APPLICATION

This is a Continuation of application Ser. No. 13/628,682 filed Sep. 27,2012, which is a Continuation of application Ser. No. 13/403,655 filedFeb. 23, 2012 and issued as U.S. Pat. No. 8,295,355, on Oct. 23, 2012,which is a Continuation of Ser. No. 13/006,657 filed Jan. 14, 2011,which claims priority from Korean Patent Application No.10-2010-0003554, filed on Jan. 14, 2010 in the Korean IntellectualProperty Office, the disclosure of which is incorporated herein in itsentirety by reference.

BACKGROUND

1. Field

Apparatuses and methods consistent with exemplary embodiments relate toencoding and decoding a motion vector, and more particularly, toencoding and decoding a motion vector by predicting a motion vector of acurrent block.

2. Description of the Related Art

A codec, such as Moving Pictures Experts Group (MPEG)-4 H.264/MPEG-4Advanced Video Coding (AVC), uses motion vectors of previously encodedblocks adjacent to a current block to predict a motion vector of thecurrent block. That is, a median of motion vectors of previously encodedblocks adjacent to left, upper, and upper-right sides of a current blockmay be used as a motion vector predictor of the current block.

SUMMARY

One or more exemplary embodiments provide a method and apparatus forencoding and decoding a motion vector, and a computer readable recordingmedium having recorded thereon a computer program for executing themethod.

According to an aspect of an exemplary embodiment, there is provided amethod of encoding a motion vector, the method including: selecting,from among a first mode and a second mode, the first mode in whichinformation indicating a motion vector predictor of at least one motionvector predictor is encoded or a second mode in which informationindicating generation of a motion vector predictor based on pixelsincluded in a previously encoded area adjacent to a current block isencoded; determining a motion vector predictor of the current blockaccording to the selected mode and encoding information about the motionvector predictor of the current block; and encoding a difference vectorbetween a motion vector of the current block and the motion vectorpredictor of the current block, wherein the second mode is a mode inwhich information indicating generation of the motion vector predictorby setting a range within which the motion vector predictor is to besearched based on the at least one motion vector predictor and bysearching within the search range by using pixels included in thepreviously encoded area, is encoded.

The selecting the first mode or the second mode may include selectingthe first mode or the second mode based on a depth indicating a degreeof decreasing from a size of a maximum coding unit of a current pictureor slice to a size of the current block.

The selecting the first mode or the second mode may include selectingthe first mode or the second mode in a unit of a current picture orslice including the current block.

The selecting the first mode or the second mode may include selectingthe first mode or the second mode based on whether the current block isencoded in a skip mode.

The at least one motion vector predictor may include a first motionvector of a block adjacent to a left side of the current block, a secondmotion vector of a block adjacent to an upper side of the current block,and a third motion vector of a block adjacent to an upper-right side ofthe current block.

The at least one motion vector predictor may further include a medianvalue of the first motion vector, the second motion vector, and thethird motion vector.

The at least one motion vector predictor may further include a motionvector predictor generated based on a motion vector of a blockco-located with the current block in a reference picture and a temporaldistance between the reference picture and a current picture.

The encoding the information about the motion vector predictor of thecurrent block may include encoding information indicating whether theblock co-located with the current block is a block of a picturetemporally preceding the current picture or a block of a picturetemporally following the current picture.

Information indicating whether the block co-located with the currentblock is the block of the picture temporally preceding the currentpicture or the block of the picture temporally following the currentpicture may be inserted into a header of a slice in which the currentblock is included.

According to an aspect of another exemplary embodiment, there isprovided an apparatus for encoding a motion vector, the apparatusincluding: a prediction unit which selects, from among a first mode anda second mode, the first mode in which information indicating one of atleast one motion vector predictor is encoded or the second mode in whichinformation indicating generation of a motion vector predictor based onpixels included in a previously encoded area adjacent to a current blockis encoded; a first encoder which determines a motion vector predictorof the current block according to the selected mode and encodesinformation about the motion vector predictor of the current block; anda second encoder which encodes a difference vector between a motionvector of the current block and the motion vector predictor of thecurrent block, wherein the second mode is a mode in which informationindicating generation of the motion vector predictor by setting a rangewithin which the motion vector predictor is to be searched based on theat least one motion vector predictor and by searching within the searchrange by using pixels included in the previously encoded area, isencoded.

According to an aspect of another exemplary embodiment, there isprovided a method of decoding a motion vector, the method including:decoding information about a motion vector predictor of a current blockencoded according to a mode selected from among a first mode and asecond mode; decoding a difference vector between a motion vector of thecurrent block and the motion vector predictor of the current block;generating the motion vector predictor of the current block based on thedecoded information about the motion vector predictor of the currentblock; and restoring the motion vector of the current block based on thegenerated motion vector predictor and the decoded difference vector,wherein the first mode is a mode in which information indicating one ofat least one motion vector predictor is encoded and the second mode is amode in which information indicating generation of the motion vectorpredictor by setting a range within which the motion vector predictor isto be searched based on the at least one motion vector predictor and bysearching within the search range by using pixels included in apreviously encoded area adjacent to the current block, is encoded.

According to an aspect of another exemplary embodiment, there isprovided an apparatus for decoding a motion vector, the apparatusincluding: a first decoder which decodes information about a motionvector predictor of a current block encoded according to a mode selectedfrom among a first mode and a second mode; a second decoder whichdecodes a difference vector between a motion vector of the current blockand the motion vector predictor of the current block; a prediction unitwhich generates the motion vector predictor of the current block basedon the decoded information about the motion vector predictor of thecurrent block; and a motion vector restorer which restores the motionvector of the current block based on the generated motion vectorpredictor and the decoded difference vector, wherein the first mode is amode in which information indicating one of at least one motion vectorpredictor is encoded and the second mode is a mode in which informationindicating generation of the motion vector predictor by setting a rangewithin which the motion vector predictor is to be searched based on theat least one motion vector predictor and by searching within the searchrange by using pixels included in a previously encoded area adjacent tothe current block, is encoded.

According to an aspect of another exemplary embodiment, there isprovided a computer readable recording medium having recorded thereon acomputer program for executing the method of encoding a motion vectorand the method of decoding a motion vector.

According to an aspect of another exemplary embodiment, there isprovided a method of encoding a motion vector, the method including:selecting, from among a first mode and a second mode, the first mode inwhich information indicating a motion vector predictor of at least onemotion vector predictor is encoded or the second mode in whichinformation indicating generation of a motion vector predictor based onpixels included in a previously encoded area adjacent to a current blockis encoded; determining a motion vector predictor of the current blockaccording to the selected mode and encoding information about the motionvector predictor of the current block; and encoding a difference vectorbetween a motion vector of the current block and the motion vectorpredictor of the current block.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects will become more apparent by describing indetail exemplary embodiments with reference to the attached drawings inwhich:

FIG. 1 is a block diagram of an apparatus for encoding an image,according to an exemplary embodiment;

FIG. 2 is a block diagram of an apparatus for decoding an image,according to an exemplary embodiment;

FIG. 3 illustrates hierarchical coding unit according to an exemplaryembodiment;

FIG. 4 is a block diagram of an image encoder based on a coding unit,according to an exemplary embodiment;

FIG. 5 is a block diagram of an image decoder based on a coding unit,according to an exemplary embodiment;

FIG. 6 illustrates a maximum coding unit, a sub coding unit, and aprediction unit, according to an exemplary embodiment;

FIG. 7 illustrates a coding unit and a transform unit, according to anexemplary embodiment;

FIGS. 8A, 8B, 8C, and 8D illustrate division shapes of a coding unit, aprediction unit, and a transform unit, according to an exemplaryembodiment;

FIG. 9 is a block diagram of an apparatus for encoding a motion vector,according to an exemplary embodiment;

FIGS. 10A and 10B illustrate motion vector predictor candidates of anexplicit mode, according to an exemplary embodiment;

FIGS. 10C through 10E illustrate blocks having various sizes that areadjacent to a current block, according to an exemplary embodiment;

FIGS. 11A through 11C illustrate motion vector predictor candidates of aclear mode, according to another exemplary embodiment;

FIG. 12A illustrates a method of generating a motion vector predictor ofan implicit mode, according to an exemplary embodiment;

FIG. 12B illustrates a method of searching for a motion vector predictorof an implicit mode, according to an exemplary embodiment;

FIGS. 12C and 12D illustrate templates used to generate motion vectorpredictors, according to an exemplary embodiment;

FIG. 13 is a block diagram of an apparatus for decoding a motion vector,according to an exemplary embodiment;

FIG. 14 is a flowchart of a method of encoding a motion vector,according to an exemplary embodiment; and

FIG. 15 is a flowchart of a method of decoding a motion vector,according to an exemplary embodiment.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

Certain exemplary embodiments are described in greater detail below withreference to the accompanying drawings. Expressions such as “at leastone of,” when preceding a list of elements, modify the entire list ofelements and do not modify the individual elements of the list. In thepresent specification, an “image” may denote a still image for a videoor a moving image, that is, the video itself.

In the following description, like drawing reference numerals are usedfor the like elements, even in different drawings. The matters definedin the description, such as detailed construction and elements, areprovided to assist in a comprehensive understanding of exemplaryembodiments. However, exemplary embodiments can be practiced withoutthose specifically defined matters.

FIG. 1 is a block diagram of an image encoding apparatus 100 forencoding an image, according to an exemplary embodiment. The imageencoding apparatus 100 may be implemented as a hardware apparatus suchas, for example, a processor of a computer or a computer system. Theimage encoding apparatus 100, or one or more components thereof, mayalso be implemented as a software module residing on the computersystem.

Referring to FIG. 1, the image encoding apparatus 100 includes a maximumencoding unit divider 110, an encoding depth determiner 120, an imagedata encoder 130, and an encoding information encoder 140 which may beimplemented, for example, as hardware or software modules integratedwithin the image encoding apparatus 100 or separately from the imageencoding apparatus 100.

The maximum encoding unit divider 110 may divide a current frame orslice based on a maximum coding unit that is a coding unit of thelargest size. That is, the maximum encoding unit divider 110 may dividethe current frame or slice into at least one maximum coding unit.

According to an exemplary embodiment, a coding unit may be representedusing a maximum coding unit and a depth. As described above, the maximumcoding unit indicates a coding unit having the largest size from amongcoding units of the current frame, and the depth indicates a degree ofhierarchically decreasing the coding unit. As a depth increases, acoding unit may decrease from a maximum coding unit to a minimum codingunit, wherein a depth of the maximum coding unit is defined as a minimumdepth and a depth of the minimum coding unit is defined as a maximumdepth. Since the size of a coding unit decreases from a maximum codingunit as a depth increases, a sub coding unit of a kth depth may includea plurality of sub coding units of a (k+n)th depth (where k and n areintegers equal to or greater than 1).

According to an increase of the size of a frame to be encoded, encodingan image in a greater coding unit may cause a higher image compressionratio. However, if a greater coding unit is fixed, an image may not beefficiently encoded by reflecting continuously changing imagecharacteristics.

For example, when a smooth area such as the sea or sky is encoded, thegreater a coding unit is, the more a compression ratio may increase.However, when a complex area such as people or buildings is encoded, thesmaller a coding unit is, the more a compression ratio may increase.

Accordingly, in an exemplary embodiment, a different maximum imagecoding unit and a different maximum depth are set for each frame orslice. Since a maximum depth denotes the maximum number of times bywhich a coding unit may decrease, the size of each minimum coding unitincluded in a maximum image coding unit may be variably set according toa maximum depth. The maximum depth may be determined differently foreach frame or slice or for each maximum coding unit.

The encoding depth determiner 120 determines a division shape of themaximum coding unit. The division shape may be determined based oncalculation of rate-distortion (RD) costs. The determined division shapeof the maximum coding unit is provided to the encoding informationencoder 140, and image data according to maximum coding units isprovided to the image data encoder 130.

A maximum coding unit may be divided into sub coding units havingdifferent sizes according to different depths, and the sub coding unitshaving different sizes, which are included in the maximum coding unit,may be predicted or frequency-transformed based on processing unitshaving different sizes. In other words, the image encoding apparatus 100may perform a plurality of processing operations for image encodingbased on processing units having various sizes and various shapes. Toencode image data, processing operations such as prediction, transform,and entropy encoding are performed, wherein processing units having thesame size or different sizes may be used for every operation.

For example, the image encoding apparatus 100 may select a processingunit that is different from a coding unit to predict the coding unit.

When the size of a coding unit is 2N×2N (where N is a positive integer),processing units for prediction may be 2N×2N, 2N×N, N×2N, and N×N. Inother words, motion prediction may be performed based on a processingunit having a shape whereby at least one of a height and a width of acoding unit is equally divided by two. Hereinafter, a processing unit,which is the base of prediction, is defined as a prediction unit.

A prediction mode may be at least one of an intra mode, an inter mode,and a skip mode, and a specific prediction mode may be performed foronly a prediction unit having a specific size or a specific shape. Forexample, the intra mode may be performed for only prediction unitshaving the sizes of 2N×2N and N×N which have the shape of a square.Further, the skip mode may be performed for only a prediction unithaving the size of 2N×2N. If a plurality of prediction units exists in acoding unit, the prediction mode with the least encoding errors may beselected after performing prediction for every prediction unit.

Alternatively, the image encoding apparatus 100 may perform frequencytransform on image data based on a processing unit having a differentsize from a coding unit. For the frequency transform in the coding unit,the frequency transform may be performed based on a processing unithaving a size equal to or smaller than that of the coding unit.Hereinafter, a processing unit, which is the base of frequencytransform, is defined as a transform unit. The frequency transform maybe discrete cosine transform (DCT) or Karhunen-Loeve transform (KLT).

The encoding depth determiner 120 may determine sub coding unitsincluded in a maximum coding unit using RD optimization based on aLagrangian multiplier. In other words, the encoding depth determiner 120may determine which shape a plurality of sub coding units divided fromthe maximum coding unit has, wherein the plurality of sub coding unitshas different sizes according to the depths of sub coding units. Theimage data encoder 130 outputs a bitstream by encoding the maximumcoding unit based on the division shapes determined by the encodingdepth determiner 120.

The encoding information encoder 140 encodes information about anencoding mode of the maximum coding unit determined by the encodingdepth determiner 120. In other words, the encoding information encoder140 outputs a bitstream by encoding information about a division shapeof the maximum coding unit, information about the maximum depth, andinformation about an encoding mode of a sub coding unit for each depth.The information about the encoding mode of the sub coding unit mayinclude information about a prediction unit of the sub coding unit,information about a prediction mode for each prediction unit, andinformation about a transform unit of the sub coding unit.

The information about the division shape of the maximum coding unit maybe flag information, indicating whether each coding unit is divided. Forexample, when the maximum coding unit is divided and encoded,information indicating whether the maximum coding unit is divided isencoded. Also, when a sub coding unit divided from the maximum codingunit is divided and encoded, information indicating whether the subcoding unit is divided is encoded.

Since sub coding units having different sizes exist for each maximumcoding unit and information about an encoding mode is determined foreach sub coding unit, information about at least one encoding mode maybe determined for one maximum coding unit.

The image encoding apparatus 100 may generate sub coding units byequally dividing the height and width of a maximum coding unit by twoaccording to an increase of depth. That is, when the size of a codingunit of a kth depth is 2N×2N, the size of a coding unit of a (k+1)thdepth is N×N.

Accordingly, the image encoding apparatus 100 may determine an optimaldivision shape for each maximum coding unit based on sizes of maximumcoding units and a maximum depth in consideration of imagecharacteristics. By variably adjusting the size of a maximum coding unitin consideration of image characteristics and encoding an image throughdivision of a maximum coding unit into sub coding units of differentdepths, images having various resolutions may be more efficientlyencoded.

FIG. 2 is a block diagram of an image decoding apparatus 200 fordecoding an image according to an exemplary embodiment. The imagedecoding apparatus 200 may be implemented as a hardware apparatus suchas, for example, a processor of a computer, or a computer system. Theimage decoding apparatus 200, or one or more components thereof, mayalso be implemented as a software module residing on the computersystem.

Referring to FIG. 2, the image decoding apparatus 200 includes an imagedata acquisition unit 210, an encoding information extractor 220, and animage data decoder 230 which may be implemented, for example, ashardware or software modules integrated within the image decodingapparatus 200 or separately from the image encoding apparatus 200.

The image data acquisition unit 210 acquires image data according tomaximum coding units by parsing a bitstream received by the imagedecoding apparatus 200 and outputs the image data to the image datadecoder 230. The image data acquisition unit 210 may extract informationabout a maximum coding unit of a current frame or slice from a header ofthe current frame or slice. In other words, the image data acquisitionunit 210 divides the bitstream in the maximum coding unit so that theimage data decoder 230 may decode the image data according to maximumcoding units.

The encoding information extractor 220 extracts information about amaximum coding unit, a maximum depth, a division shape of the maximumcoding unit, and an encoding mode of sub coding units from the header ofthe current frame by parsing the bitstream received by the imagedecoding apparatus 200. The information about a division shape and theinformation about an encoding mode are provided to the image datadecoder 230.

The information about a division shape of the maximum coding unit mayinclude information about sub coding units having different sizesaccording to depths and included in the maximum coding unit, and may beflag information indicating whether each coding unit is divided.

The information about an encoding mode may include information about aprediction unit according to sub coding units, information about aprediction mode, and information about a transform unit.

The image data decoder 230 restores the current frame by decoding imagedata of every maximum coding unit based on the information extracted bythe encoding information extractor 220.

The image data decoder 230 may decode sub coding units included in amaximum coding unit based on the information about a division shape ofthe maximum coding unit. A decoding process may include a predictionprocess including intra prediction and motion compensation and aninverse transform process.

The image data decoder 230 may perform intra prediction or interprediction based on information about a prediction unit and informationabout a prediction mode to predict a prediction unit. The image datadecoder 230 may also perform inverse transform for each sub coding unitbased on information about a transform unit of a sub coding unit.

FIG. 3 illustrates hierarchical coding units according to an exemplaryembodiment.

Referring to FIG. 3, the hierarchical coding units may include codingunits whose widths and heights are 64×64, 32×32, 16×16, 8×8, and 4×4.Besides these coding units having perfect square shapes, coding unitswhose widths and heights are 64×32, 32×64, 32×16, 16×32, 16×8, 8×16,8×4, and 4×8 may also exist.

Referring to FIG. 3, for image data set 310 whose resolution is1920×1080, the size of a maximum coding unit is set to 64×64, and amaximum depth is set to 2.

For image data set 320 whose resolution is 1920×1080, the size of amaximum coding unit is set to 64×64, and a maximum depth is set to 3.For image data set 330 whose resolution is 352×288, the size of amaximum coding unit is set to 16×16, and a maximum depth is set to 1.

When the resolution is high or the amount of data is great, a maximumsize of a coding unit may be set relatively great to increase acompression ratio and reflect image characteristics more precisely.Accordingly, for the image data sets 310 and 320 having higherresolution than the image data set 330, 64×64 may be selected as thesize of a maximum coding unit.

A maximum depth indicates the total number of layers in the hierarchicalcoding units. Since the maximum depth of the image data set 310 is 2, acoding unit 315 of the image data set 310 may include a maximum codingunit whose longer axis size is 64 and sub coding units whose longer axissizes are 32 and 16, according to an increase of a depth.

On the other hand, since the maximum depth of the image data set 330 is1, a coding unit 335 of the image data set 330 may include a maximumcoding unit whose longer axis size is 16 and coding units whose longeraxis sizes are 8, according to an increase of a depth.

However, since the maximum depth of the image data 320 is 3, a codingunit 325 of the image data set 320 may include a maximum coding unitwhose longer axis size is 64 and sub coding units whose longer axissizes are 32, 16, 8 and 4 according to an increase of a depth. Since animage is encoded based on a smaller sub coding unit as a depthincreases, exemplary embodiments are suitable for encoding an imageincluding more minute scenes.

FIG. 4 is a block diagram of an image encoder 400 based on a codingunit, according to an exemplary embodiment. The image encoder 400, orone or more components thereof, may be implemented as a hardware devicesuch as, for example, a processor of a computer or as a software moduleresiding on the computer system.

An intra predictor 410 performs intra prediction on prediction units ofthe intra mode in a current frame 405, and a motion estimator 420 and amotion compensator 425 perform inter prediction and motion compensationon prediction units of the inter mode using the current frame 405 and areference frame 495. The intra predictor 410, the motion estimator 420,the motion compensator 425, and the reference frame 495 may beimplemented, for example, as hardware or software modules integratedwithin the image encoder 400 or separately from the image encoder 400.

Residual values are generated based on the prediction units output fromthe intra predictor 410, the motion estimator 420, and the motioncompensator 425. The generated residual values are output as quantizedtransform coefficients by passing through a transformer 430 and aquantizer 440.

The quantized transform coefficients are restored to residual values bypassing through an inverse quantizer 460 and an inverse transformer 470,and the restored residual values are post-processed by passing through adeblocking unit 480 and a loop filtering unit 490 and output as thereference frame 495. The quantized transform coefficients may be outputas a bitstream 455 by passing through an entropy encoder 450.

To perform encoding based on an encoding method according to anexemplary embodiment, the intra predictor 410, the motion estimator 420,the motion compensator 425, the transformer 430, the quantizer 440, theentropy encoder 450, the inverse quantizer 460, the inverse transformer470, the deblocking unit 480, and the loop filtering unit 490 of theimage encoder 400 perform image encoding processes based on a maximumcoding unit, a sub coding unit according to depths, a prediction unit,and a transform unit.

FIG. 5 is a block diagram of an image decoder 500 based on a codingunit, according to an exemplary embodiment. The image decoder 500, orone or more components thereof, may be implemented as a hardware devicesuch as, for example, a processor of a computer or as a software moduleresiding on the computer system.

A bitstream 505 passes through a parser 510 so that the encoded imagedata to be decoded and encoding information used for decoding areparsed. The encoded image data is output as inverse-quantized data bypassing through an entropy decoder 520 and an inverse quantizer 530 andrestored to residual values by passing through an inverse transformer540. The residual values are restored according to coding units by beingadded to an intra prediction result of an intra predictor 550 or amotion compensation result of a motion compensator 560. The restoredcoding units are used for prediction of next coding units or a nextframe by passing through a deblocking unit 570 and a loop filtering unit580. The parser 510, the entropy decoder 520, the inverse quantizer 530,the inverse transformer 540, the intra predictor 550, the compensator560, the deblocking unit 570, and the loop filtering unit 580 may beimplemented, for example, as hardware or software modules integratedwithin the image decoder 500 or separately from the image decoder 500.

To perform decoding based on a decoding method according to an exemplaryembodiment, the parser 510, the entropy decoder 520, the inversequantizer 530, the inverse transformer 540, the intra predictor 550, themotion compensator 560, the deblocking unit 570, and the loop filteringunit 580 of the image decoder 500 perform image decoding processes basedon a maximum coding unit, a sub coding unit according to depths, aprediction unit, and a transform unit.

In particular, the intra predictor 550 and the motion compensator 560determine a prediction unit and a prediction mode in a sub coding unitby considering a maximum coding unit and a depth, and the inversetransformer 540 performs inverse transform by considering the size of atransform unit.

FIG. 6 illustrates a maximum coding unit, a sub coding unit, and aprediction unit, according to an exemplary embodiment.

The image encoding apparatus 100 illustrated in FIG. 1 and the imagedecoding apparatus 200 illustrated in FIG. 2 use hierarchical codingunits to perform encoding and decoding in consideration of imagecharacteristics. A maximum coding unit and a maximum depth may beadaptively set according to the image characteristics or variously setaccording to requirements of a user.

In FIG. 6, a hierarchical coding unit structure 600 has a maximum codingunit 610 which is a maximum coding unit whose height and width are 64and maximum depth is 4. A depth increases along a vertical axis of thehierarchical coding unit structure 600, and as a depth increases,heights and widths of sub coding units 620 to 650 decrease. Predictionunits of the maximum coding unit 610 and the sub coding units 620 to 650are shown along a horizontal axis of the hierarchical coding unitstructure 600.

The maximum coding unit 610 has a depth of 0 and the size of an codingunit, or a height and a width, of 64×64. A depth increases along thevertical axis, and there exist a first sub coding unit 620 whose size is32×32 and depth is 1, a second sub coding unit 630 whose size is 16×16and depth is 2, a third sub coding unit 640 whose size is 8×8 and depthis 3, and a minimum coding unit 650 whose size is 4×4 and depth is 4.The minimum coding unit 650 whose size is 4×4 and depth is 4 is aminimum coding unit, and the minimum coding unit may be divided intoprediction units, each of which is less than the minimum coding unit.

Referring to FIG. 6, examples of prediction units are shown along thehorizontal axis according to each depth. That is, a prediction unit ofthe maximum coding unit 610 whose depth is 0 may be a prediction unitwhose size is equal to the size 64×64 of the maximum coding unit, or aprediction unit 612 whose size is 64×32, a prediction unit 614 whosesize is 32×64, or a prediction unit 616 whose size is 32×32, which has asize smaller than that of the maximum coding unit whose size is 64×64.

A prediction unit of the first sub coding unit 620 whose depth is 1 andsize is 32×32 may be a prediction unit whose size is equal to the size32×32 of the first sub coding unit, or a prediction unit 622 whose sizeis 32×16, a prediction unit 624 whose size is 16×32, or a predictionunit 626 whose size is 16×16, which has a size smaller than that of thefirst sub coding unit 620 whose size is 32×32.

A prediction unit of the second sub coding unit 630 whose depth is 2 andsize is 16×16 may be a prediction unit whose size is equal to the size16×16 of the second sub coding unit 630, or a prediction unit 632 whosesize is 16×8, a prediction unit 634 whose size is 8×16, or a predictionunit 636 whose size is 8×8, which has a size smaller than that of thesecond sub coding unit 630 whose size is 16×16.

A prediction unit of the third sub coding unit 640 whose depth is 3 andsize is 8×8 may be a prediction unit whose size is equal to the size 8×8of the third sub coding unit 640 or a prediction unit 642 whose size is8×4, a prediction unit 644 whose size is 4×8, or a prediction unit 646whose size is 4×4, which has a size smaller than that of the third subcoding unit 640 whose size is 8×8.

The minimum coding unit 650 whose depth is 4 and size is 4×4 is aminimum coding unit and a coding unit of a maximum depth. A predictionunit of the minimum coding unit 650 may be a prediction unit 650 whosesize is 4×4, a prediction unit 652 having a size of 4×2, a predictionunit 654 having a size of 2×4, or a prediction unit 656 having a size of2×2.

FIG. 7 illustrates a coding unit and a transform unit, according to anexemplary embodiment.

The image encoding apparatus 100 illustrated in FIG. 1 and the imagedecoding apparatus 200 illustrated in FIG. 2 perform encoding anddecoding with a maximum coding unit itself or with sub coding units,which are equal to or smaller than the maximum coding unit, divided fromthe maximum coding unit. In the encoding and decoding process, the sizeof a transform unit for frequency transform is selected to be no largerthan that of a corresponding coding unit. For example, if a currentcoding unit 710 has the size of 64×64, frequency transform may beperformed using a transform unit 720 having the size of 32×32.

FIGS. 8A, 8B, 8C, and 8D illustrate division shapes of a coding unit810, a prediction unit 860, and a transform unit 870, according to anexemplary embodiment.

FIGS. 8A and 8B illustrate a coding unit 810 and a prediction unit 860,according to an exemplary embodiment.

FIG. 8A shows a division shape selected by the image encoding apparatus100 illustrated in FIG. 1, to encode a maximum coding unit 810. Theimage encoding apparatus 100 divides the maximum coding unit 810 intovarious shapes, performs encoding, and selects an optimal division shapeby comparing encoding results of various division shapes with each otherbased on the RD costs. When it is optimal that the maximum coding unit810 be encoded as it is, the maximum coding unit 810 may be encodedwithout dividing the maximum coding unit 810 as illustrated in FIGS. 8Athrough 8D.

Referring to FIG. 8A, the maximum coding unit 810 whose depth is 0 isencoded by dividing it into sub coding units whose depths are equal toor greater than 1. That is, the maximum coding unit 810 is divided into4 sub coding units whose depths are 1, and all or some of the sub codingunits whose depths are 1 are divided into sub coding units 814, 816,818, 828, 850, and 852 whose depths are 2.

A sub coding unit located in an upper-right side and a sub coding unitlocated in a lower-left side among the sub coding units whose depths are1 are divided into sub coding units whose depths are equal to or greaterthan 2. Some of the sub coding units whose depths are equal to orgreater than 2 may be divided into sub coding units 820, 822, 824, 826,830, 832, 840, 842, 844, 846, and 848 whose depths are equal to orgreater than 3.

FIG. 8B shows a division shape of a prediction unit 860 for the maximumcoding unit 810.

Referring to FIG. 8B, a prediction unit 860 for the maximum coding unit810 may be divided differently from the maximum coding unit 810. Inother words, a prediction unit for each of sub coding units may besmaller than a corresponding sub coding unit.

For example, a prediction unit for a sub coding unit 854 located in alower-right side among the sub coding units 812, 854 whose depths are 1may be smaller than the sub coding unit 854. In addition, predictionunits for sub coding units 814, 816, 850, and 852 of sub coding units814, 816, 818, 828, 850, and 852 whose depths are 2 may be smaller thanthe sub coding units 814, 816, 850, and 852, respectively.

In addition, prediction units for sub coding units 822, 832, and 848whose depths are 3 may be smaller than the sub coding units 822, 832,and 848, respectively. The prediction units may have a shape wherebyrespective sub coding units are equally divided by two in a direction ofheight or width or have a shape whereby respective sub coding units areequally divided by four in directions of height and width.

FIGS. 8C and 8D illustrate a prediction unit 860 and a transform unit870, according to an exemplary embodiment.

FIG. 8C shows a division shape of a prediction unit 860 for the maximumcoding unit 810 shown in FIG. 8B, and FIG. 8D shows a division shape ofa transform unit 870 of the maximum coding unit 810.

Referring to FIG. 8D, a division shape of a transform unit 870 may beset differently from the prediction unit 860.

For example, even though a prediction unit for the sub coding unit 854whose depth is 1 is selected with a shape whereby the height of the subcoding unit 854 is equally divided by two, a transform unit may beselected with the original size of the sub coding unit 854. Likewise,even though prediction units for sub coding units 814 and 850 whosedepths are 2 are selected with a shape whereby the height of each of thesub coding units 814 and 850 is equally divided by two, a transform unitmay be selected with the same size as the original size of each of thesub coding units 814 and 850.

A transform unit may be selected with a smaller size than a predictionunit. For example, when a prediction unit for the sub coding unit 852whose depth is 2 is selected with a shape whereby the width of the subcoding unit 852 is equally divided by two, a transform unit may beselected with a shape whereby the sub coding unit 852 is equally dividedby four in directions of height and width, which has a smaller size thanthe shape of the prediction unit.

FIG. 9 is a block diagram of an apparatus 900 for encoding a motionvector, according to an exemplary embodiment.

The apparatus 900 for encoding a motion vector may be included in theapparatus 100 described above in association with FIG. 1 or the imagedecoder 400 described above in association with FIG. 4. Referring toFIG. 9, a motion vector encoding apparatus 900 according to an exemplaryembodiment includes a prediction unit 910, a first encoder 920, and asecond encoder 930.

In order to decode a block encoded using inter prediction, i.e.,inter-picture prediction, information about a motion vector indicating aposition difference between a current block and a similar block in areference picture is used. Thus, information about motion vectors isencoded and inserted into a bitstream in an image encoding process.However, if the information about motion vectors is encoded and insertedas it is, an overhead for encoding the information about motion vectorsincreases, thereby decreasing a compression ratio of image data.

Therefore, in an image encoding process, information about a motionvector is compressed by predicting a motion vector of a current block,encoding only a differential vector between a motion vector predictorgenerated as a result of prediction and an original motion vector, andinserting the encoded differential vector into a bitstream. FIG. 9 showsan apparatus 900 for encoding a motion vector, which uses such a motionvector predictor.

Referring to FIG. 9, the prediction unit 910 determines whether a motionvector of a current block is prediction-encoded based on an explicitmode or an implicit mode.

As described above, such a codec as MPEG-4 H.264/MPEG-4 AVC uses motionvectors of previously encoded blocks adjacent to a current block topredict a motion vector of the current block. For example, a median ofmotion vectors of previously encoded blocks adjacent to left, upper, andupper-right sides of the current block may be used as a motion vectorpredictor of the current block. Since motion vectors of all blocksencoded using inter prediction are predicted using the same method,information about a motion vector predictor does not have to be encodedseparately. However, the apparatus 100 or the image decoder 400,according to an exemplary embodiment, uses both a mode in whichinformation about a motion vector predictor is not encoded separatelyand a mode in which information about a motion vector predictor isencoded in order to more exactly predict a motion vector, which will nowbe described in detail.

(1) Explicit Mode

One of methods of encoding a motion vector predictor, which can beselected by the prediction unit 910, can be a mode of explicitlyencoding information about a motion vector predictor of a current block.The explicit mode is a mode of separately encoding informationindicating which motion vector predictor from among at least one motionvector predictor candidate is used to predict a motion vector of acurrent block. Motion vector predictor candidates according to anexemplary embodiment will be described with reference to FIGS. 10A, 10B,and 11A to 11C.

FIGS. 10A and 10B illustrate motion vector predictor candidates of anexplicit mode, according to an exemplary embodiment.

Referring to FIG. 10A, a motion vector predicting method according to anexemplary embodiment can use one of motion vectors of previously encodedblocks adjacent to a current block as a motion vector predictor of thecurrent block. A block a₀ in the leftmost among blocks adjacent to anupper side of the current block, a block b₀ in the upper-most amongblocks adjacent to a left side thereof, a block c adjacent to anupper-right side thereof, a block d adjacent to an upper-left sidethereof, and a block e adjacent to a lower-left side thereof can be usedfor motion vector predictors of the current block.

In a method of encoding an image and a method of decoding an imageaccording to exemplary embodiments, an image is encoded and decodedbased on coding units having different sizes differentiated according todepths. Thus, a motion vector of the block adjacent to the lower-leftside of the current block may also be used as a motion vector predictorof the current block.

Referring to FIG. 8A, if a current block is a coding unit 820, a codingunit 814 adjacent to an upper-left side of the current block, a codingunit 816 in a leftmost block among blocks adjacent to an upper side ofthe current block, a coding unit 818 in an upper-most block among blocksadjacent to a left side thereof, a coding unit 822 adjacent to anupper-right side thereof, and a coding unit 824 adjacent to a lower-leftside thereof are encoded before the current block. Thus, a motion vectorof a block adjacent to the lower-left side of the current block may beused as a motion vector predictor of the current block.

Referring to FIG. 10B, motion vectors of all blocks adjacent to acurrent block can be used as motion vector predictors of the currentblock. In other words, motion vectors of not only a block a₀ in theleftmost among blocks adjacent to an upper side of the current block butalso all blocks a₀ to a_(n) adjacent to the upper side thereof can beused as motion vector predictors of the current block, and motionvectors of not only a block b₀ in the upper-most among blocks adjacentto a left side thereof but also all blocks b₀ to b_(n) adjacent to theleft side thereof can be used as motion vector predictors of the currentblock.

Alternatively, a median value of motion vectors of adjacent blocks canbe used as a motion vector predictor. In other words, median (mv_a0,mv_b0, mv_c) can be used a motion vector predictor of the current block,wherein mv_a0 denotes a motion vector of the block a0, mv_b0 denotes amotion vector of the block b0, and mv_c denotes a motion vector of theblock c.

Motion vector predictor candidates of the current block can be limitedaccording to the size of the current block and sizes of blocks adjacentto the current block. This will be described in detail with reference toFIGS. 10C through 10E.

FIGS. 10C through 10E illustrate blocks having various sizes adjacent toa current block, according to an exemplary embodiment.

As described above, in the method of encoding an image and the method ofdecoding an image according to exemplary embodiments, the image isencoded using coding units having various sizes and prediction unitshaving various sizes, which are determined according to depths. Thus,the sizes of blocks adjacent to the current block may vary. Thus, if thesize of the current block differs greatly from the sizes of some blocksadjacent to the current block, motion vectors of one or more blockshaving different sizes adjacent to the current block may not be used asmotion vector predictors of the current block.

Referring to FIG. 10C, blocks 1014 through 1018 adjacent to the upperside of a current block 1010 are blocks having sizes smaller than thesize of the current block 1010. Since there may be a high possibilitythat the motion vector of a block 1012, which is adjacent to the currentblock 1010 and has the same size as that of the current block 1010, maybe the same as or similar to the motion vector of the current block1010, the prediction unit 910 may use only the motion vector of theblock 1012, which is adjacent to the current block 1010 and has the samesize as that of the current block 1010, as a motion vector predictor.

Even though the size of the block 1012 is not the same as the size ofthe current block 1010, only motion vectors of blocks, which areadjacent to the current block 1010 and have predetermined sizes, may beused as motion vector predictors. For example, only motion vectors ofblocks 1012 and 1018 having sizes that are equal to or greater than ¼ ofthe size of the current block 1010 may be used as motion vectorpredictors.

Referring to FIG. 10D, the size of a block 1022 adjacent to the leftside of a current block 1020 is 16 times the size of the current block1020, and there is a great difference therebetween. Due to this greatdifference, there may be a low possibility that the motion vector of theblock 1022 adjacent to the left side of the current block 1020 may bethe same as or similar to the motion vector of the current block 1020.Thus, the motion vector of the block 1022 adjacent to the left side ofthe current block 1020 may not be used as a motion vector predictor ofthe current block 1020, and only a motion vector of a block 1024adjacent to the upper side of the current block 1020 and a motion vectorof a block 1026 adjacent to the upper-left side of the current block1020 may be used as motion vector predictors of the current block 1020.

Referring to FIG. 10E, the size of a current block 1030 is greater thansizes of all blocks 1031 through 1037 adjacent to the current block1030. In this case, if motion vectors of all blocks 1031 through 1037adjacent to the current block 1030 are used as motion vector predictorsof the current block 1030, the number of motion vector predictorcandidates of the current block 1030 may be too large. As a differencebetween the size of the current block 1030 and the sizes of the blocks1031 through 1037 adjacent to the current block 1030 is increased, thenumber of motion vector predictor candidates is increased. Thus, theprediction unit 910 illustrated in FIG. 9 does not use motion vectors ofone or more blocks adjacent to the current block 1030 as motion vectorpredictors of the current block 1030.

For example, in the exemplary embodiment of FIG. 10E, a motion vector ofthe block 1031 adjacent to the lower-left side of the current block 1030and a motion vector of the block 1037 adjacent to the upper-right sideof the current block 1030 may not be used as motion vector predictors ofthe current block 1030.

Thus, if the size of the current block 1030 is equal to or greater thana predetermined size, motion vectors of blocks adjacent to the currentblock 1030 in predetermined directions may not be used as motion vectorpredictors of the current block 1030.

FIGS. 11A through 11C illustrate motion vector predictor candidates ofan explicit mode, according to another exemplary embodiment.

FIG. 11A illustrates a method of calculating a motion vector predictorof a Bi-directional Predictive Picture (referred to as ‘B picture’),according to an exemplary embodiment. When a current picture including acurrent block is a B picture in which bi-directional prediction isperformed, a motion vector generated based on a temporal distance may bea motion vector predictor.

A motion vector predictor mv_temporal of a current block 1100 of acurrent picture 1110 can be generated using a motion vector of a block1120 in a co-located position of a temporally preceding picture 1112.For example, if a motion vector mv_colA of the block 1120 in a positionco-located with the current block 1100 is generated for a searched block1122 of a temporally following picture 1114 of the current picture 1110,motion vector predictor candidates mv_L0A and mv_L1A of the currentblock 1100 can be generated in accordance with the equations below:mv _(—) L1A=(t1/t2)×mv_colAmv _(—) L0A=mv _(—) L1A−mv_colAwhere mv_L0A denotes a motion vector predictor of the current block 1100for the temporally preceding picture 1112, and mv_L1A denotes a motionvector predictor of the current block 1100 for the temporally followingpicture 1114.

In the exemplary embodiment of FIG. 11A, the current picture 1110 thatis a B picture exists between the temporally preceding picture 1112 andthe temporally following picture 1114. In this case, if the motionvector mv_colA of the block 1120 in a position co-located with thecurrent block 1100 is generated from the temporally following picture1114, the motion vector of the current block 1100 may be more accuratelypredicted based on mv_L1A. In other words, compared to a case whenmv_colA is a motion vector having an opposite direction to a directionillustrated in FIG. 11A, i.e., a case when mv_colA is generated fromanother picture before the temporally preceding picture 1112, whenmv_colA is a motion vector in the direction of FIG. 11A, the motionvector of the current block 1100 may be more accurately predicted.

Thus, if a direction from the current block 1100 to the block 1120 in aposition co-located with the current block 1100 is a direction List0,the motion vector mv_colA of the block 1120 in a position co-locatedwith the current block 1100 should be in a direction List1 so that apossibility that the current picture 1110 may exist between thetemporally preceding picture 1112 and the temporally following picture1114, as illustrated in FIG. 11A, can increase and the motion vector ofthe current block 1100 can be more accurately predicted based onmv_colA.

In addition, since the pictures 1110 through 1114 illustrated in FIG.11A are arranged in a temporal sequence, a motion vector predictormv_temporal of the current block 1100 may be generated based on apicture order count (POC). Since a picture referred to by the currentblock 1100 may be a picture that is different from the pictures 1112 and1114 illustrated in FIG. 11A, the motion vector predictor mv_temporal ofthe current block 1100 is generated based on the POC.

For example, if a POC of a current picture is CurrPOC and a POC of apicture referred to by the current picture is CurrRefPOC, the motionvector predictor mv_temporal of the current block 1100 can be generatedin accordance with the equations below:Scale=(CurrPOC−CurrRefPOC)/(ColPOC−ColRefPOC)mv_temporal=Scale*mv_colA

where ColPOC is a POC of the temporally preceding picture 1112 in whicha block 1120 in a position co-located with the current block 1100 isincluded, and ColRefPOC is a POC of the temporally following picture1114 in which a block 1122 referred to by the block 1120 in a positionco-located with the current block 1100 is included.

FIG. 11B illustrates a method of generating a motion vector predictor ofa B picture, according to another exemplary embodiment. Compared withthe method illustrated in FIG. 11A, a block in a position co-locatedwith the current block 1100 exists in the temporally following picture1114.

Referring to FIG. 11B, a motion vector predictor of the current block1100 of the current picture 1110 can be generated using a motion vectorof a block 1130 in a co-located position of the temporally followingpicture 1114. For example, if a motion vector mv_colB of the block 1130in a position co-located with the current block 1100 is generated for asearched block 1132 of the temporally preceding picture 1112 of thecurrent picture 1110, motion vector predictor candidates mv_L0B andmv_L1B of the current block 1100 can be generated in accordance with theequations below:mv _(—) L0B=(t3/t4)×mv_colBmv _(—) L1B=mv _(—) L0B−mv_colBwhere mv_L0B denotes a motion vector predictor of the current block 1100for the temporally preceding picture 1112, and mv_L1B denotes a motionvector predictor of the current block 1100 for the temporally followingpicture 1114.

Similar to FIG. 11A, in the exemplary embodiment of FIG. 11B, thecurrent picture 1110 that is a B picture exists between the temporallypreceding picture 1112 and the temporally following picture 1114. Thus,if the motion vector mv_colB of the block 1130 in a position co-locatedwith the current block 1100 is generated for the temporally precedingpicture 1112, a motion vector of the current block 1100 may be moreaccurately predicted based on mv_L0B. In other words, compared to a casewhen mv_colB is a motion vector having an opposite direction to adirection illustrated in FIG. 11B, i.e., a case when mv_colB isgenerated from another picture after the temporally following picture1114, when mv_colB is a motion vector in the direction of FIG. 11B, themotion vector of the current block 1100 may be more accuratelypredicted.

Thus, if a direction from the current block 1100 to the block 1130 in aposition co-located with the current block 1100 is a direction List1,the motion vector mv_colB of the block 1130 in a position co-locatedwith the current block 1100 should be in the direction List0 so that apossibility that the current picture 1110 may exist between thetemporally preceding picture 1112 and the temporally following picture1114, as illustrated in FIG. 11B, can increase and the motion vector ofthe current block 1100 can be more accurately predicted based onmv_colB.

In addition, since a picture referred to by the current block 1100 maybe a picture other than the pictures 1112 and 1114 illustrated in FIG.11B, a motion vector predictor of the current block 1100 may begenerated based on the POC.

For example, if a POC of a current picture is CurrPOC and a POC of apicture referred to by the current picture is CurrRefPOC, the motionvector predictor of the current block 1100 can be generated inaccordance with the equations below:Scale=(CurrPOC−CurrRefPOC)/(ColPOC−ColRefPOC)mv_temporal=Scale*mv_colBwhere ColPOC is a POC of the temporally following picture 1114 in whicha block 1130 in a position co-located with the current block 1100 isincluded, and ColRefPOC is a POC of the temporally preceding picture1112 in which a block 1132 referred to by the block 1130 in a positionco-located with the current block 1100 is included.

In the generation of a motion vector of the current block 1100 of a Bpicture by using the prediction unit 910, one of the methods illustratedin FIGS. 11A and 11B can be used. In other words, since a motion vectorpredictor is generated using a motion vector and a temporal distance ofthe block 1120 or 1130 in a position co-located with the current block1100, motion vector predictors can be generated using the methodsillustrated in FIGS. 11A and 11B only if motion vectors of the blocks1120 and 1130 in the co-located position exist. Thus, the predictionunit 910 according to an exemplary embodiment generates a motion vectorpredictor of the current block 1100 using only a block having a motionvector among the blocks 1120 and 1130 in the co-located position.

For example, when the block 1120 in a co-located position of thetemporally preceding picture 1112 is encoded using intra predictioninstead of inter prediction, a motion vector of the block 1120 does notexist, and thus a motion vector predictor of the current block 1100cannot be generated using the method of generating a motion vectorpredictor as illustrated in FIG. 11A.

The block 1120 in a co-located position of the temporally precedingpicture 1112 and the block 1130 in a co-located position of thetemporally following picture 1114 may be used to generate the motionvector predictor of the current picture 1110 of the B picture by usingthe prediction unit 910, as illustrated in FIGS. 11A and 11B. Thus, amotion vector predictor of the current block 1100 can be decoded only ifthe apparatus 900 for encoding a motion vector knows which block of theblocks 1120 and 1130, in a position co-located with the current block1100, is used to generate the motion vector predictor mv_temporal.

To this end, the apparatus 900 for encoding a motion vector may encodeinformation for specifying which block of the blocks 1120 and 1130 in aposition co-located with the current block 1100 is used to generate themotion vector predictor mv_temporal and may insert encoded informationinto a block header or a slice header.

FIG. 11C illustrates a method of generating a motion vector predictor ofa P picture, according to an exemplary embodiment.

Referring to FIG. 11C, a motion vector predictor of the current block1100 of the current picture 1110 can be generated using a motion vectorof a block 1140 in a co-located position of the temporally precedingpicture 1112. For example, if a motion vector mv_colC of the block 1140in a position co-located with the current block 1100 is generated for asearched block 1142 of another temporally preceding picture 1116, amotion vector predictor candidate mv_L0C of the current block 1100 canbe generated in accordance with the equation below:mv _(—) L0C=(t6/t5)×mv_colC.

As described above in association with FIGS. 11 and 11B, mv_L0C may alsobe generated based on the POC. Based on the POC of the current picture1110, the POC of the picture referred to by the current picture 1110,the POC of the temporally preceding picture 1112, and the POC of anothertemporally preceding picture 1116, mv_L0C may be generated.

Since the current picture 1110 is a P picture, the number of motionvector predictors of the current block 1100 is 1 unlike FIGS. 11A and11B.

In summary, a set C of motion vector predictor candidates according toFIGS. 10A, 10B, and 11A to 11C can be generated in accordance with theequation below:C={median(mv _(—) a0, mv _(—) b0, mv _(—) c), mv _(—) a0, mv _(—) a1 . .. , mv _(—) aN, mv _(—) b0, mv _(—) b1, . . . , mv _(—) aN, mv _(—) c,mv _(—) d, mv _(—) e, mv_temporal}.

Alternatively, the set C may be generated by reducing the number ofmotion vector predictor candidates in accordance with the equationbelow:C={median(mv _(—) a′, mv _(—) b′, mv _(—) c′), mv _(—) a′, mv _(—) b′,mv _(—) c′, mv_temporal}.

Herein, mv_x denotes a motion vector of a block x, median( ) denotes amedian value, and mv_temporal denotes motion vector predictor candidatesgenerated using a temporal distance described above in association withFIGS. 11A to 11C.

In addition, mv_a′ denotes a very first valid motion vector among mv_a0,mv_a1 . . . , mv_aN. For example, when a block a0 has been encoded usingintra prediction or refers to a picture different from a picturereferred to by the current block, a motion vector mv_a0 of the block a0is not valid, and thus mv_a′=mv_a1, and if a motion vector of a block a1is also not valid, mv_a′=mv_a2.

Likewise, mv_b′ denotes the very first valid motion vector among mv_b0,mv_b1 . . . , mv_bN, and mv_c′ denotes the very first valid motionvector among mv_c, mv_d, and mv_e.

A motion vector of a block that refers to a picture different from apicture referred to by the current block, from among motion vectors ofblocks adjacent to the current block, may not predict a motion vector ofthe current block efficiently. Thus, the motion vector of the block thatrefers to a picture different from a picture referred to by the currentblock may be excluded from the set C of motion vector predictorcandidates.

The explicit mode is a mode of encoding information indicating whichmotion vector has been used for a motion vector predictor of a currentblock. For example, when a motion vector is encoded in the explicitmode, a binary number can be allocated to each of elements of the set C,i.e., motion vector predictor candidates, and if one of them is used asa motion vector predictor of a current block, a corresponding binarynumber can be output.

Since a corresponding binary number is allocated to each motion vectorpredictor candidate so as to specify one of the elements of the set Cand is output, as the number of elements of the set C decreases, theelements of the set C may be specified as binary numbers with smallerbits.

Thus, if an overlapping motion vector predictor candidate is present inthe set C, the overlapping motion vector predictor candidate may beexcluded from the set C, and binary numbers are allocated to the motionvector predictor candidates. For example, when the set C={median(mv_a′,mv_b′, mv_c′), mv_a′, mv_b′, mv_c′, mv_temporal}, as described above, ifmv_a′, mv_b′, and mv_c′ are all the same, the set C may be determined asthree elements like in C={median(mv_a′, mv_b′, mv_c′), mv_a′,mv_temporal}, and the binary numbers are allocated. If the elements ofthe set C may be specified using 3 bits before the overlapping motionvector predictor candidate is excluded from the set C, the elements ofthe set C may be specified using 2 bits after the overlapping motionvector predictor candidate is excluded from the set C.

Instead of excluding the overlapping motion vector predictor candidatefrom the set C, a predetermined weight may be added so as to increase aprobability that the overlapping motion vector predictor candidate maybe determined as the motion vector predictor of the current block.Since, in the example described above, mv_a′, mv_b′, and mv_c′ are allthe same and only mv_a′ is included in the set C, a probability thatmv_a′ may be determined as the motion vector predictor of the currentblock may be increased by adding a predetermined weight to mv_a′.

In addition, when there is just one motion vector predictor candidate,in spite of the explicit mode, binary numbers for specifying one ofmotion vector predictor candidates may not be encoded. For example, whenthe set C={median(mv_a0, mv_b0, mv_c), mv_a0, mv_a1 . . . , mv_aN,mv_b0, mv_b1, . . . , mv_bN, mv_c, mv_d, mv_e, mv_temporal} and ifblocks a0 through aN, blocks b0 through bN, a block c, a block d, and ablock e are intra-predicted blocks, the set C={mv_temporal} and thussubstantially includes one element. Thus, in this case, the apparatus900 for encoding a motion vector may not encode binary numbers forspecifying one motion vector predictor candidate from among a pluralityof motion vector predictor candidates in spite of the explicit mode.

It will be easily understood by those of ordinary skill in the art thatother motion vector predictor candidates besides those described abovein association with the explicit mode can be used.

(2) Implicit Mode

Another one of the methods of encoding a motion vector predictor, whichcan be selected by the prediction unit 910, is a mode of encoding onlyinformation indicating that a motion vector predictor of a current blockis generated based on blocks or pixels included in a previously encodedarea adjacent to the current block. Unlike the explicit mode, theimplicit mode is a mode of encoding information indicating generation ofa motion vector predictor in the implicit mode without encodinginformation for specifying a motion vector predictor.

As described above, such a codec as MPEG-4 H.264/MPEG-4 AVC uses motionvectors of previously encoded blocks adjacent to a current block topredict a motion vector of the current block. That is, a median ofmotion vectors of previously encoded blocks adjacent to left, upper, andupper-right sides of the current block is used as a motion vectorpredictor of the current block. In this case, unlike the explicit mode,information for selecting one of motion vector predictor candidates doesnot have to be encoded.

In other words, if only information indicating that a motion vectorpredictor of a current block has been encoded in the implicit mode isencoded in an image encoding process, a median value of motion vectorsof previously encoded blocks adjacent to left, upper, and upper-rightsides of the current block can be used as a motion vector predictor ofthe current block in an image decoding process.

In addition, an image encoding method according to an exemplaryembodiment provides a new implicit mode of generating a motion vectorpredictor by using previously encoded pixel values adjacent to thecurrent block as a template. This will be described in detail withreference to FIG. 12A.

FIG. 12A illustrates a method of generating a motion vector predictor inthe explicit mode, according to an exemplary embodiment.

Referring to FIG. 12A, pixels 1222 included in a previously encoded area1220 adjacent to a current block 1200 of a current picture 1210 are usedto generate a motion vector predictor of the current block 1200.Corresponding pixels 1224 are determined by searching a referencepicture 1212 using the adjacent pixels 1222. The corresponding pixels1224 can be determined by calculating a Sum of Absolute Differences(SAD). When the corresponding pixels 1224 are determined, a motionvector mv_template of the adjacent pixels 1222 is generated, and themotion vector mv_template can be used as a motion vector predictor ofthe current block 1200.

A set C of motion vector predictor candidates may be used to searchmv_template from the reference picture 1212. This will now be describedin detail with reference to FIG. 12B.

FIG. 12B illustrates a method of searching for a motion vector predictorof an implicit mode, according to an exemplary embodiment.

Referring to FIG. 12B, when the prediction unit 910 searches thereference picture 1212 by using the pixels 1222 adjacent to the currentblock 1200, a predetermined search range 1226 may be set, andcorresponding pixels 1224 may be searched only within the predeterminedsearch range 1226.

The search range 1226 may be set based on the motion vector predictorcandidates described above. The center of the search range 1226 may bedetermined based on the motion vector predictor candidates, and an areaincluded in a predetermined pixel range may be set as the search range1226 from the determined center of the search range. Since there may bea plurality of motion vector predictor candidates, a plurality of searchranges 1226 may be set, and the search ranges 1226 may be set indifferent pictures.

The corresponding pixels 1224 having the smallest SAD are determined bysearching the plurality of search ranges 1226, and mv_template isgenerated based on the determination. Sizes and shapes of the pixels1222 adjacent to the current block 1200 may vary. Thus, this will now bedescribed in detail with reference to FIG. 12C.

FIG. 12C illustrates a template used to generate motion vectorpredictors, according to an exemplary embodiment.

Referring to FIG. 12C, the pixels 1222 adjacent to the current block1200 that are used to generate the motion vector predictor of thecurrent block 1200 by using the prediction unit 910, as illustrated inFIG. 12A, may have different sizes and shapes.

For example, when the size of the current block 1200 is 4×4, the pixels1222 adjacent to the current block 1220 may be set to include only ninepixels, as illustrated in FIG. 12C, and pixels 1228 adjacent to thecurrent block 1220 may be set to include nine or more pixels. Inaddition, the pixels 1222 may be set to have a shape other than theshape ‘

’, as illustrated in FIGS. 12A through 12C.

FIG. 12D illustrates a template used to generate motion vectorpredictors, according to another exemplary embodiment.

In the calculation of an SAD, not all of the pixels adjacent to thecurrent block 1200 are used, and only some of the pixels 1222 adjacentto the current block 1200 may be used. For example, an SAD may becalculated using only three, five or seven pixels from among the ninepixels 1222 having the size of 4×4 adjacent to the current block 1200.FIG. 12D illustrates a template for calculating an SAD by using only apixel adjacent to the upper-left side of the current block, a pixel inthe rightmost side among pixels adjacent to the upper side thereof, anda pixel in the lower-most side among pixels adjacent to the left-sidethereof.

Information about different sizes and shapes of the templates describedabove with reference to FIGS. 12B through 12D may be encoded separatelyfrom a motion vector, may be encoded as slice parameters and insertedinto a slice header, or may be encoded as sequence parameters andinserted into a bitstream.

If a mode of using a median of motion vectors of adjacent blocks as amotion vector predictor is defined as ‘implicit mode_(—)1’, and if amode of generating a motion vector predictor using pixels adjacent to acurrent block is defined as ‘implicit mode_(—)2’, a motion vectorpredictor can be generated using one of the two implicit modes implicitmode_(—)1 and implicit mode_(—)2 by encoding information about one ofthe two implicit modes in an image encoding process and referring to theinformation about a mode in an image decoding process.

(3) Mode Selection

There may be various criteria for the prediction unit 910 to select oneof the above-described explicit mode and implicit mode.

Since one of a plurality of motion vector predictor candidates isselected in the explicit mode, a motion vector predictor more similar toa motion vector of a current block can be selected. Instead, sinceinformation indicating one of a plurality of motion vector predictorcandidates is encoded, a greater overhead than in the implicit modes mayoccur. Thus, for a coding unit having a large size, it is proper toencode a motion vector in the explicit mode because a probability ofincreasing an error occurring when a motion vector is wrongly predictedis higher for a coding unit having a large size than a coding unithaving a small size and when the size of a coding unit is large thefrequency of overhead occurrence decreases for each picture.

For example, when a picture equally divided into m coding units havingthe size of 64×64 is encoded in the explicit mode, the number ofoverhead occurrence times is m. However, when a picture, which has thesame size, equally divided into 4m coding units having the size of 32×32is encoded in the explicit mode, the number of overhead occurrence timesis 4m.

Accordingly, the prediction unit 910 according to an exemplaryembodiment can select one of the explicit mode and the implicit modebased on the size of a coding unit when a motion vector of a currentblock is encoded.

Since the size of a coding unit in the image encoding method and theimage decoding method according to exemplary embodiments described abovein association with FIGS. 1 to 8 is represented using a depth, thepredictor 910 selects, based on a depth of a current block, whether amotion vector of the current block is encoded in the explicit mode orthe implicit mode. For example, when coding units whose depths are 0 and1 are inter-predicted, motion vectors of the coding units are encoded inthe explicit mode, and when coding units whose depths are equal to orgreater than 2 are inter-predicted, motion vectors of the coding unitsare encoded in the implicit mode.

According to another exemplary embodiment, the prediction unit 910 canselect the explicit mode or the implicit mode for each picture or sliceunit. Since image characteristics are different for each picture orslice unit, the explicit mode or the implicit mode can be selected foreach picture or slice unit by considering these image characteristics.Motion vectors of coding units included in a current picture or slicecan be prediction-encoded by selecting an optimal mode from among theexplicit mode and the implicit mode in consideration of R-D cost.

For example, if motion vectors of coding units included in a picture orslice can be exactly predicted without using the explicit mode, motionvectors of all coding units included in the picture or slice can beprediction-encoded in the implicit mode.

According to another exemplary embodiment, the prediction unit 910 mayselect the explicit mode or the implicit mode based on whether a currentblock has been encoded in the skip mode. The skip mode is an encodingmode in which only flag information indicating that a current block hasbeen encoded in the skip mode is encoded without encoding a pixel value.

The skip mode is a mode in which a pixel value of a current block is notencoded if a prediction block generated by performing motioncompensation using a motion vector predictor as a motion vector of thecurrent block is similar to the current block. Thus, as a motion vectorpredictor is generated more similarly to a motion vector of a currentblock, a probability of encoding the current block in the skip mode ishigher. Accordingly, a block encoded in the skip mode can be encoded inthe explicit mode.

Referring back to FIG. 9, when the prediction unit 910 selects one ofthe explicit mode and the implicit mode and determines a motion vectorpredictor according to the selected mode, the first encoder 920 and thesecond encoder 930 encode information about an encoding mode and amotion vector.

The first encoder 920 encodes information about a motion vectorpredictor of a current block. In more detail, when the prediction unit910 selects that a motion vector of the current block is encoded in theexplicit mode, the first encoder 920 encodes information indicating thata motion vector predictor has been generated in the explicit mode andinformation indicating which motion vector predictor candidate has beenused as the motion vector predictor of the current block.

In addition, if a plurality of motion vector predictor candidatesinclude mv_temporal described above with reference to FIGS. 11A through11C, information indicating whether a block 1200 or 1300 in a positionco-located with the current block, which is a base for generatingmv_temporal, is a block of a temporally preceding picture or a block ofa temporally following picture, is also encoded.

On the contrary, when the prediction unit 910 selects that the motionvector of the current block is encoded in the implicit mode, the firstencoder 920 encodes information indicating that the motion vectorpredictor of the current block has been generated in the implicit mode.In other words, the first encoder 920 encodes information indicating themotion vector predictor of the current block has been generated usingblocks or pixels adjacent to the current block. If two or more implicitmodes are used, the first encoder 920 may further encode informationindicating which implicit mode has been used to generate the motionvector predictor of the current block.

The implicit mode may be a mode in which a motion vector predictor of acurrent block is generated by setting a search range based on motionvector predictor candidates of the current block and by searching withina search range set based on pixels of a previously encoded area adjacentto the current block, as illustrated in FIG. 12C.

The second encoder 930 encodes a motion vector of a current block basedon a motion vector predictor determined by the prediction unit 910.Alternatively, the second encoder 930 generates a difference vector bysubtracting the motion vector predictor generated by the prediction unit910 from the motion vector of the current block generated as a result ofmotion compensation and encodes information about the difference vector.

FIG. 13 is a block diagram of an apparatus 1300 for decoding a motionvector, according to an exemplary embodiment.

An apparatus 1300 for decoding a motion vector, which may be included inthe image decoding apparatus 200 described above in association withFIG. 2 or the image decoder 500 described above in association with FIG.5, will now be described in detail. Referring to FIG. 13, a motionvector decoding apparatus 1300 includes a first decoder 1310, a seconddecoder 1320, a prediction unit 1330, and a motion vector restorer 1340.

The first decoder 1310 decodes information about a motion vectorpredictor of a current block, which is included in a bitstream. Indetail, the first decoder 1310 decodes information indicating whetherthe motion vector predictor of the current block has been encoded in theexplicit mode or the implicit mode.

When the motion vector predictor of the current block has been encodedin the explicit mode, the first decoder 1310 further decodes informationindicating one motion vector predictor used as the motion vectorpredictor of the current block among a plurality of motion vectorpredictors.

In addition, if a plurality of motion vector predictor candidatesinclude mv_temporal described above with reference to FIGS. 11A through11C, information indicating whether a block 1200 or 1300 in a positionco-located with the current block, which is a base for generatingmv_temporal, is a block of a temporally preceding picture or a block ofa temporally following picture, is also decoded.

When the motion vector predictor of the current block has been encodedin the implicit mode, the first decoder 1310 may further decodeinformation indicating which one of a plurality of implicit modes hasbeen used to encode the motion vector predictor of the current block.

The implicit mode may be a mode in which a motion vector predictor of acurrent block is generated by setting a search range based on motionvector predictor candidates of the current block and by searching withina search range set based on pixels of a previously encoded area adjacentto the current block, as illustrated in FIG. 12C.

The second decoder 1320 decodes a difference vector between a motionvector and the motion vector predictor of the current block included inthe bitstream.

The prediction unit 1330 generates a motion vector predictor of thecurrent block based on the information about the motion vector predictorof the current block, which has been decoded by the first decoder 1310.

When the information about the motion vector predictor of the currentblock, which has been encoded in the explicit mode, is decoded, theprediction unit 1330 generates one motion vector predictor among themotion vector predictor candidates described above in association withFIGS. 10A, 10B, and 11A to 11C and uses it as the motion vectorpredictor of the current block.

When the information about the motion vector predictor of the currentblock, which has been encoded in the implicit mode, is decoded, theprediction unit 1330 generates the motion vector predictor of thecurrent block using blocks or pixels included in a previously encodedarea adjacent to the current block. In more detail, the prediction unit1330 generates a median value of motion vectors of blocks adjacent tothe current block as the motion vector predictor of the current block orgenerates the motion vector predictor of the current block by searchinga reference picture using pixels adjacent to the current block.

The motion vector restorer 1340 restores a motion vector of the currentblock by summing the motion vector predictor generated by the predictionunit 1330 and the difference vector decoded by the second decoder 1320.The restored motion vector is used for motion compensation of thecurrent block.

FIG. 14 is a flowchart of a method of encoding a motion vector,according to an exemplary embodiment.

Referring to FIG. 14, a motion vector encoding apparatus according to anexemplary embodiment selects one of the explicit mode and the implicitmode as a mode of encoding information about a motion vector predictorin operation 1410.

The explicit mode is a mode of encoding information indicating onemotion vector predictor candidate among at least one motion vectorpredictor candidate as information about a motion vector predictor, andthe implicit mode is a mode of encoding information indicating that amotion vector predictor has been generated based on blocks or pixelsincluded in a previously encoded area adjacent to a current block asinformation about the motion vector predictor. Detailed descriptionsthereof have been given above in association with FIGS. 10A to 10E, 11Ato 11C, and 12A to 12C.

A mode can be selected based on the size of a current block, i.e., adepth of the current block, or selected in a unit of a current pictureor slice in which the current block is included. Alternatively, a modecan be selected according to whether the current block has been encodedin the skip mode.

In operation 1420, the motion vector encoding apparatus determines amotion vector predictor according to the mode selected in operation1410. In detail, the motion vector encoding apparatus determines amotion vector predictor of the current block based on the explicit modeor implicit mode selected in operation 1410. In more detail, the motionvector encoding apparatus determines one motion vector predictorcandidate among at least one motion vector predictor candidate as themotion vector predictor of the current block in the explicit mode ordetermines the motion vector predictor of the current block based onblocks or pixels adjacent to the current block in the implicit mode.

In operation 1430, the motion vector encoding apparatus encodesinformation about the motion vector predictor determined in operation1420.

In the case of the explicit mode, the motion vector encoding apparatusencodes information indicating one motion vector predictor candidateamong at least one motion vector predictor candidate and informationindicating that information about the motion vector predictor of thecurrent block has been encoded in the explicit mode.

In addition, if a plurality of motion vector predictor candidatesinclude mv_temporal described above with reference to FIGS. 11A through11C, information indicating whether a block 1200 or 1300 in a positionco-located with the current block, which is a base for generatingmv_temporal, is a block of a temporally preceding picture or a block ofa temporally following picture, is also encoded.

In the case of the implicit mode, the motion vector encoding apparatusencodes information indicating that the motion vector predictor of thecurrent block has been generated based on blocks or pixels included in apreviously encoded area adjacent to the current block. In the case of aplurality of implicit modes, the motion vector encoding apparatus mayfurther encode information indicating one of the plurality of implicitmodes.

The implicit mode may be a mode in which a motion vector predictor of acurrent block is generated by setting a search range based on motionvector predictor candidates of the current block and by searching withina search range set based on pixels of a previously encoded area adjacentto the current block, as illustrated in FIG. 12C.

In operation 1440, the motion vector encoding apparatus encodes adifference vector generated by subtracting the motion vector predictordetermined in operation 1420 from a motion vector of the current block.

FIG. 15 is a flowchart of a method of decoding a motion vector,according to an exemplary embodiment.

Referring to FIG. 15, a motion vector decoding apparatus according to anexemplary embodiment decodes information about a motion vector predictorof a current block, which is included in a bitstream, in operation 1510.In detail, the motion vector decoding apparatus decodes informationabout a mode used to encode the motion vector predictor of the currentblock among the explicit mode or the implicit mode.

In the case of the explicit mode, the motion vector decoding apparatusdecodes information indicating that the motion vector predictor of thecurrent block has been encoded in the explicit mode and informationabout one motion vector predictor candidate among at least one motionvector predictor candidate.

In addition, if a plurality of motion vector predictor candidatesinclude mv_temporal described above with reference to FIGS. 11A through11C, information indicating whether a block 1200 or 1300 in a positionco-located with the current block, which is a base for generatingmv_temporal, is a block of a temporally preceding picture or a block ofa temporally following picture, is also decoded.

In the case of the implicit mode, the motion vector decoding apparatusdecodes information indicating that the motion vector predictor of thecurrent block has been generated based on blocks or pixels included in apreviously decoded area adjacent to the current block. In the case of aplurality of implicit modes, the motion vector decoding apparatus mayfurther decode information indicating one of the plurality of implicitmodes.

The implicit mode may be a mode in which a motion vector predictor of acurrent block is generated by setting a search range based on motionvector predictor candidates of the current block and by searching withina search range set based on pixels of a previously encoded area adjacentto the current block, as illustrated in FIG. 12C.

In operation 1520, the motion vector decoding apparatus decodesinformation about a difference vector. The difference vector is a vectorof a difference between the motion vector predictor of the current blockand a motion vector of the current block.

In operation 1530, the motion vector decoding apparatus generates themotion vector predictor of the current block based on the informationabout the motion vector predictor, which has been decoded in operation1510. In detail, the motion vector decoding apparatus generates themotion vector predictor of the current block according to the explicitmode or the implicit mode. In more detail, the motion vector decodingapparatus generates the motion vector predictor of the current block byselecting one motion vector predictor candidate among at least onemotion vector predictor candidate or using blocks or pixels included ina previously decoded area adjacent to the current block.

In operation 1540, the motion vector decoding apparatus restores themotion vector of the current block by summing the difference vectordecoded in operation 1520 and the motion vector predictor generated inoperation 1530.

As described above, according to exemplary embodiments, a motion vectormay be more accurately predicted by using both a mode in whichinformation about a motion vector is not separately encoded and a modein which information about a motion vector predictor is encoded.

While exemplary embodiments have been particularly shown and describedabove, it will be understood by one of ordinary skill in the art thatvarious changes in form and details may be made therein withoutdeparting from the spirit and scope of the inventive concept as definedby the following claims and their equivalents. Also, an exemplaryembodiment can be embodied as computer readable codes on a computerreadable recording medium.

For example, the image encoding or decoding apparatus, the image encoderor decoder, the apparatus for encoding a motion vector and the apparatusfor decoding a motion vector illustrated in FIGS. 1, 2, 4, 5, 9, and 13may include a bus coupled to every unit of the apparatus or encoder, atleast one processor that is connected to the bus and is for executingcommands, and memory connected to the bus to store the commands,received messages, and generated messages.

The computer readable recording medium is any data storage device thatcan store data which can be thereafter read by a computer system.Examples of the computer readable recording medium include read-onlymemory (ROM), random-access memory (RAM), CD-ROMs, magnetic tapes,floppy disks, and optical data storage devices. The computer readablerecording medium can also be distributed over network coupled computersystems so that the computer readable code is stored and executed in adistributed fashion.

What is claimed is:
 1. An apparatus for decoding an image, the apparatuscomprising: an image data acquisition unit which acquires image dataencoded by using a coding unit of a hierarchical structure split from amaximum coding unit; an encoding information extractor which obtainsprediction mode information of a current block from a bitstream; and animage data decoder which obtains motion vector predictor candidates ofthe current block using a block co-located with the current block in areference picture in temporal direction when a prediction mode of thecurrent block is inter-prediction, obtains a motion vector predictor ofthe current block among the obtained motion vector predictor candidatesbased on information indicating a motion vector predictor used for thecurrent block and obtains a motion vector of the current block based onthe obtained motion vector predictor and a differential vector obtainedfrom the bitstream, wherein the image is split into a plurality ofmaximum coding units according to information about a maximum size ofthe coding unit, the maximum coding unit is hierarchically split intoone or more coding units of depths including at least one of a currentdepth and a lower depth, and a current coding unit of the current depthis one of rectangular data units split from a coding unit of an upperdepth.
 2. The apparatus of claim 1, wherein the image data decoderscales a motion vector of the block co-located with the current block inthe reference picture based on a temporal distance between the referencepicture and a current picture.